package view.mediator.monster.large_monster
{

	import org.robotlegs.mvcs.StarlingMediator;
	
	import view.component.monster.large_monster.LMonsterDetailView;
	import view.event.monster.LMonsterDetailViewEvent;
	
	/**
	 * 大型怪物详细情报界面中介
	 * @author £iang
	 * 
	 */	
	public class LMonsterDetailViewMediator extends StarlingMediator
	{
		//-----------------------------
		// variables
		//-----------------------------
		
		/** LMonsterDetailView界面 */
		[Inject]
		public var lMonsterDetailView:LMonsterDetailView;
		
		//-----------------------------
		// properties
		//-----------------------------
		
		//-----------------------------
		// setter&getter
		//-----------------------------
		
		//-----------------------------
		// methods
		//-----------------------------
		
		/**
		 *  注册函数
		 * 
		 */		
		override public function onRegister():void
		{
			addContextListener( LMonsterDetailViewEvent.SHOW_FIRST_SCREEN, showFirstScreenHandler );
			addViewListener( LMonsterDetailViewEvent.BACK_TO_LIST, backToListHandler );
		}
		
		//-----------------------------
		// events
		//-----------------------------
		
		/**
		 * 处理将导航栏翻到第一页的事件 
		 * @param event
		 * 
		 */		
		private function showFirstScreenHandler( event:LMonsterDetailViewEvent ):void
		{
			lMonsterDetailView.showFirstScreen();
		}
		
		/**
		 * 处理请求返回怪物列表派发的事件 
		 * @param event 请求返回怪物列表派发的事件 
		 * 
		 */		
		protected function backToListHandler( event:LMonsterDetailViewEvent ):void
		{
			dispatch( event );
		}
		
		//-----------------------------
		// dispose
		//-----------------------------
		
		/**
		 * 移除函数 
		 * 
		 */		
		override public function onRemove():void
		{
			removeContextListener( LMonsterDetailViewEvent.SHOW_FIRST_SCREEN, showFirstScreenHandler );
			removeViewListener( LMonsterDetailViewEvent.BACK_TO_LIST, backToListHandler );
		
			//lMonsterDetailView.changeNavigator( LMonsterDetailNavigatorScreenName.NONE );
			lMonsterDetailView.clearNavi();
			super.onRemove();
		}
		//-----------------------------
		// construction
		//-----------------------------
		
		/**
		 * 构造函数
		 *
		 */
		public function LMonsterDetailViewMediator()
		{
			super();
		}
	}
}